home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / PowerPlant / CTriangleControl / UDrawingState.More.cp < prev    next >
Encoding:
Text File  |  1994-12-05  |  1.4 KB  |  65 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    UDrawingState.More.cp                ©1994 Mike Shields. All rights reserved.
  3. // ===========================================================================
  4. //
  5. //    Classes for saving/restoring the drawing state
  6. //
  7. //    For each class, the Constructor saves the current state and the
  8. //    Destructor restores it, so you can use stack-based objects to
  9. //    automatically save and restore the state.
  10. //
  11. //    There are separate Save and Restore functions in case you want to
  12. //    explicitly change the state (at other than construct and destruct time).
  13. //
  14. //    Finally, each class has a Normalize function which sets the state of
  15. //    the current GrafPort to default values (same as those set by OpenPort).
  16.  
  17. #ifdef PowerPlant_PCH
  18. #include PowerPlant_PCH
  19. #endif
  20.  
  21. #include "UDrawingState.More.h"
  22.  
  23. // ===========================================================================
  24. //    StPenState
  25. // ===========================================================================
  26. //
  27. //    Pen State Info:
  28. //        Pen Location
  29. //        Pen Size
  30. //        Pen Mode
  31. //        Pen Pattern
  32.  
  33. StPenState::StPenState()
  34. {
  35.     ::GetPenState(&mPenState);
  36. }
  37.  
  38.  
  39. StPenState::~StPenState()
  40. {
  41.     ::SetPenState(&mPenState);
  42. }
  43.  
  44.  
  45. void
  46. StPenState::Save()
  47. {
  48.     ::GetPenState(&mPenState);
  49. }
  50.  
  51.  
  52. void
  53. StPenState::Restore()
  54. {
  55.     ::SetPenState(&mPenState);
  56. }
  57.  
  58.  
  59. void
  60. StPenState::Normalize()
  61. {
  62.     ::PenNormal();
  63. }
  64.  
  65.